package my.netty.channel.nio;

import my.netty.channel.Channel;
import my.netty.channel.EventLoop;
import my.netty.channel.EventLoopGroup;
import my.netty.concurrent.EventExecutor;
import my.netty.concurrent.MultiThreadEventExecutorGroup;

import java.util.concurrent.ThreadFactory;

public class NioEventLoopGroup extends MultiThreadEventExecutorGroup implements EventLoopGroup {

    public NioEventLoopGroup(int threads) {
        super(threads);
    }

    public NioEventLoopGroup(int threads, ThreadFactory threadFactory) {
        super(threads, threadFactory);
    }

    @Override
    protected EventExecutor newChild(ThreadFactory threadFactory) throws Exception {
        return new NioEventLoop(this, threadFactory);
    }

    @Override
    public EventLoop next() {
        return (EventLoop) super.next();
    }

    @Override
    public void register(Channel channel) {
        next().register(channel);
    }
}
